<script setup lang="ts">
import { onHide, onShow } from '@dcloudio/uni-app'
import { navigateToInterceptor } from '@/router/interceptor'

onShow((options) => {
  // 处理直接进入页面路由的情况：如h5直接输入路由、微信小程序分享后进入等
  // https://github.com/unibest-tech/unibest/issues/192
  if (options?.path) {
    navigateToInterceptor.invoke({ url: `/${options.path}`, query: options.query })
  }
  else {
    navigateToInterceptor.invoke({ url: '/' })
  }
})
onHide(() => {
  console.log('App Hide')
})
</script>

<style lang="scss">
// 全局样式重置和优化
* {
  box-sizing: border-box;
}

page {
  background-color: #f8fffe;
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
    'Helvetica Neue', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
  font-size: 28rpx;
  line-height: 1.6;
  color: #2c3e50;
}

image {
  width: 100%;
  height: 100%;
  vertical-align: middle;
}

// 为自定义导航栏页面添加状态栏高度
.custom-navbar {
  padding-top: var(--status-bar-height, 0);
}

// 统一的按钮悬停效果
.btn-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  &:active {
    transform: translateY(1rpx) scale(0.98);
  }
}

// 统一的毛玻璃效果
.glass-effect {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 255, 254, 0.95));
  backdrop-filter: blur(20rpx);
  border: 1rpx solid rgba(82, 196, 26, 0.15);
}
</style>
